import { Injectable } from '@angular/core';
// import {Observable} from 'rxjs/Observable'; //angular5的写法，己过时
// import { Observable, of } from 'rxjs';
// import { catchError, map, tap } from 'rxjs/operators';

import { Http } from '@angular/http'

import 'rxjs/add/operator/map';

@Injectable()
export class DataService {
  users:string[];
  // data:Observable<any>;
  constructor(public http:Http) {
    // this.users=["叶永明","李福娣","叶轻扬"];
   }
   getUsers(){
   return this.http.get('https://jsonplaceholder.typicode.com/posts') 
     .map(res => res.json());
  }
  
}
